<template>
<div class="box">
    <div class="container">
        <div>
            <ul>
                <!-- <li class="l1" >
                    <span style="border-right: 1px solid #E6E6E6; padding: 10px 8px; " class="ss s1"></span>
                    <span style="border-right: 1px solid #E6E6E6; padding: 10px 8px;" class="ss s2">标题</span>
                    <span style="border-right: 1px solid #E6E6E6; padding: 10px 8px;" class="ss s3">时长</span>
                    <span style="padding: 10px 8px;" class="ss s4">歌手</span>
                </li> -->
                <li v-for="(v,i) in hotSongs" :key="v.id" class="l2" @mouseenter="enter(i)" @mouseleave="leave(i)" @click="$router.push(`/song/${v.id}`)">
                    <span class="ss s1">{{i+1}}</span>
                    <span class="ss s2">
                        <i class="el-icon-video-play" style="font-size:17px;vertical-align: middle;"></i>
                        {{v.name}}
                    </span>
                    <span class="ss s3">
                        <i ref="ii">{{v.dt | time('mm:ss')}}</i>
                        <i ref="lili" class="font" style="display:none">
                            <i style="padding-right:2px" class="el-icon-plus"></i>
                            <i style="padding-right:2px" class="el-icon-folder-add"></i>
                            <i style="padding-right:2px" class="el-icon-share"></i>
                            <i  class="el-icon-download"></i>
                        </i>
                    </span>
                    <span class="ss s4">{{v.al.name}}</span>
                </li>
            </ul>
        </div>
    </div>

</div>

</template>

<script>
import { getDetailMusicById } from '@/api/RankingList'
export default {
  props: {
    hotSongs: Array
  },
  data () {
    return {
      list: [],
      playCount: ''
    }
  },
  created () {
    this.getDetailMusicById()
  },
  methods: {
    enter (i) {
      this.$refs.ii[i].style.display = 'none'
      this.$refs.lili[i].style.display = 'block'
    },
    leave (i) {
      this.$refs.ii[i].style.display = 'block'
      this.$refs.lili[i].style.display = 'none'
    },
    async getDetailMusicById () {
      const res = await getDetailMusicById({ id: this.id })
      this.playCount = res.data.playlist.playCount
      this.list = res.data.playlist.tracks
    }
  },
  watch: {
    id: async function (val) {
      const res = await getDetailMusicById({ id: val })
      this.playCount = res.data.playlist.playCount
      this.list = res.data.playlist.tracks
    }
  }
}
</script>

<style scoped>
.box {
    display: flex;
    justify-content: center;
    align-items: center;
}
.container {
    width: 670px;
}
.div{
    display: flex;
}
.h2{
    font-size: 20px;
    font-weight: normal;
}
.count{
    padding-left: 20px;
    font-size: 12px;
    color: #666;
}
.play{
    font-size: 12px;
}
.play i{
    font-weight: 700;
}
.l1{
    width: 670px;
    height: 38px;
    background-color: #F0F0F0;

}
.ss{
    float: left;
    height: 100%;
    font-size: 12px;
    color: #666;

}
.s1{
    width: 60px;
}
.s2{
    width: 280px;
}
.s3{
    width: 80px;
}
.s4{
    width: 300x;
}
.l2{
    height: 29px;
    line-height: 29px;
}
.l2:hover {
    cursor: pointer;
}
.l2 .ss{
    padding-left: 12px;
}
.l2:nth-child(2n+1){
    background-color: #F7F7F7;
}
.font{
    color: #333;
    font-size: 15px;
}

</style>
